package com.op.crm.service;

import java.util.List;

import com.op.crm.persist.model.Action;
import com.op.crm.persist.model.Group;
import com.op.crm.persist.model.Role;
import com.op.crm.persist.model.User;

public interface SecurityService {
	
	public void saveUser(User user) throws Exception;
	/**
	 * @param action
	 * @return 返回-1代表唯一键冲突，返回0表示插入成功
	 * @throws Exception
	 * 
	 */
	public int saveAction(Action action) throws Exception;
	public int saveRole(Role role) throws Exception;
	public int saveGroup(Group group) throws Exception;
	
	public int updateAction(Action action) throws Exception;
	public int updateRole(Role role) throws Exception;
	public int updateGroup(Group group) throws Exception;
	
	public User getUser(String username) throws Exception;
	public Action getAction(String actionId) throws Exception;
	public Role getRole(String roleId) throws Exception;
	public Group getGroup(String groupId) throws Exception;
	
	public List<Action> selectActions() throws Exception;
	public List<Role> selectRoles() throws Exception;
	
	public List<Action> selectActionByIds(List<String> idList) throws Exception;
	public List<Role> selectRoleByIds(List<String> idList) throws Exception;
	public List<Group> selectGroupByIds(List<String> idList) throws Exception;
	public List<User> selectUserByIds(List<String> idList) throws Exception;
	
	public List<Action> selectActionNotIn(final List<Action> actions) throws Exception;
	
	public void deleteAction(String actionId) throws Exception;
}
